package com.kun.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kun.entity.SysUser;
import com.kun.vo.SysUserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author kun.li
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("SELECT t1.*,t2.dept_name FROM sys_user t1 left join sys_dept t2 on t1.dept_id=t2.dept_id ${ew.customSqlSegment}")
    Page<SysUserVO> selectUserPage(IPage page,@Param(Constants.WRAPPER) Wrapper queryWrapper);

    @InterceptorIgnore(tenantLine = "true")
    @Select("select * from  sys_user where user_id=#{userId} and tenant_id=#{tenantId}")
    SysUser selectByIdIgnore(@Param("userId") String userId,@Param("tenantId") String tenantId);
}
